
//
//  DataTypeCovert.m
//  DogeLegs
//
//  Created by 宋华 on 2017/8/17.
//  Copyright © 2017年 宋华. All rights reserved.
//

#import "DataTypeCovert.h"

@implementation DataTypeCovert

NSString *objectToString(id obj) {
    if ([obj isKindOfClass:[NSNumber class]]) {
        return [obj stringValue];
    }else if ([obj isKindOfClass:[NSString class]]){
        return obj;
    }else{
        return @"";
    }
}

NSString *intToString(NSInteger i) {
    return NSStringFormat(@"%ld",i);
}

NSString *chekCateory(NSString *cat) {
    if (cat.length <= 0) {
        return @"choose a category";
    }
    return cat;
}

BOOL isPureNumandCharacters(NSString * string) {
    NSMutableCharacterSet *cset = [NSMutableCharacterSet decimalDigitCharacterSet];
    [cset addCharactersInString:@"."];
    string = [string stringByTrimmingCharactersInSet:cset];
    if(string.length > 0)
    {
        return NO;
    }
    return YES;

}

@end
